/********************************************************************
 * PROJECT: CSAIR ROST PROJECT.
 * SUPPLIER: FOREVER OPEN SOURCE SOFTWARE INC.
 ********************************************************************
 * FILE: GanttGridViewerColumn.java
 * (C) Copyright Foliage Team 2013, All Rights Reserved.
 ********************************************************************/
package org.foliage.rcp.ui.viewer;

import org.eclipse.jface.viewers.ILabelProvider;
import org.foliage.rcp.ui.custom.GanttGridColumn;
import org.foliage.rcp.ui.custom.GanttGrid;

public class GanttGridViewerColumn {

	// ----------------------------------------------- 

	private GanttGridColumn column = null;

	private ILabelProvider labelProvider;

	private GanttGridViewer viewer;

	private int usedStyle = 0;

	// ----------------------------------------------- 

	public GanttGridViewerColumn(GanttGridViewer viewer, int style) {
		this(viewer, style, -1);
	}

	public GanttGridViewerColumn(GanttGridViewer viewer, int style, int index) {
		this.viewer = viewer;
		this.usedStyle = style;
		this.column = new GanttGridColumn((GanttGrid) viewer.getControl(), usedStyle);
		init();
	}

	// ----------------------------------------------- 

	private void init() {
		viewer.newColumn(this);
	}

	// ----------------------------------------------- 

	public ILabelProvider getLabelProvider() {
		return labelProvider;
	}

	public void setLabelProvider(ILabelProvider labelProvider) {
		this.labelProvider = labelProvider;
	}

	public void setMenuEnabled() {
		column.setMenuEnabled();
	}

	public void setWidth(int width) {
		column.setWidth(width);
	}

	public void setText(String text) {
		column.setText(text);
	}

	public GanttGridViewer getViewer() {
		return viewer;
	}

	public GanttGridColumn getColumn() {
		return column;
	}

}
